home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / telecom / 86 / modula / moddev1.doc < prev    next >
Encoding:
Text File  |  1986-12-19  |  6.8 KB  |  219 lines

  1.                  USING PCOMMAND WITH TDI MODULA-2
  2.                  by Bob Rogers (GEnie R.C.ROGERS)
  3.  
  4. The command line interpreter pcommand (a shareware product from 
  5. Solid Applications Inc.) is an ideal replacement for TDI's 
  6. desktop.  It makes your ST look like a PC with commands like "dir" 
  7. (for a directory listing) and gives you the ability to write batch 
  8. files that will automate many of your programming tasks.  Using 
  9. pcommand is much faster than using the desktop and gives you more 
  10. control over where you can put your files. 
  11.  
  12. I'll describe how I set up my system as an example of how pcommand 
  13. can be used with Modula.  I have a 1040 ST with one drive and the 
  14. developers' version of Modula.  I also use a 550k RAM disk 
  15. (Charles Semton's fine public domain fastram program, which can be 
  16. set up to be just about any size and which doesn't take an 
  17. accessory slot).   I've set up my system to minimize the time I 
  18. spend waiting for compiles and links.  Since I edit and compile 
  19. more than I link I put the compiler, symbol files, and editor on 
  20. RAM disk and the linker and link files on the physical drive.  I 
  21. also keep source files on the real disk -- to protect them from my 
  22. mistakes. 
  23.  
  24.                               SET UP
  25.  
  26. My Modula boot disk contains an auto folder with a time and date 
  27. setter (autodate by Vanya Cooper - the best public domain clock 
  28. setting program I've found) and the RAM disk which is set up as 
  29. drive D.
  30.  
  31. The boot disk also has a folder called copy2ram.  This is where I 
  32. put all the files that will be put on the RAM disk.  A 
  33. subdirectory under copy2ram, called symlib, contains all the .sym 
  34. files that came with TDI's package.  Other files in copy2ram are 
  35. the TDI compiler, editor, modulast.ovl folder, the file 
  36. gemaccx.lnk, pcommand, and a set of batch files I'll be describing 
  37. latter.
  38.  
  39. The root directory of the boot disk has a desktop.inf file, desk 
  40. accessories, pcommand (under an alias, see below), a pcommand 
  41. autoexec.bat file and the m2paths.txt file, which I've set up like 
  42. this:
  43.  
  44. D:\
  45. D:\SYMLIB\
  46. A:\
  47. A:\LNKLIB\
  48.  
  49. I saved the desktop with the A drive's root directory displayed on 
  50. the screen, so when boot-up is done I double-click a renamed copy 
  51. of pcommand (I changed the name to start_up as a memory jogger).  
  52. When it runs the following autoexec.bat file is automatically 
  53. executed: 
  54.  
  55. echo off
  56. log off
  57. verify off
  58. copy a:\copy2ram\*.* d:
  59. verify on
  60. prompt $n:$p > 
  61. switchar -
  62. path a:\
  63. cd a:\
  64. cd d:\
  65. d:
  66. cd \
  67.  
  68.  
  69. When all that's done (and it does take a while) all you have to do 
  70. is put in your work disk and you're ready to go.  The work disk 
  71. contains the folder lnklib, which contains all the .lnk files that 
  72. come with Modula.  The other essential item on the work disk is 
  73. the TDI linker, which has to be in the root directory to work with 
  74. the batch files I've written.
  75.  
  76.  
  77.                          THE BATCH FILES
  78.  
  79. These following batch files are all kept on the RAM disk for 
  80. speed.  Note that they assume a set-up like I've described above.  
  81. Source files are referenced by drive designator (e.g. a:) only -- 
  82. this means the files can be in any subdirectory on the A drive as 
  83. long as it is the current default for that drive (a subdirectory 
  84. is made the default by using the cd command).  All the batch files 
  85. that call the compiler will call the editor if any errors were
  86. errors found.  All batch files that call the editor delete the 
  87. backup file when the editor is done.
  88.  
  89. AUTOEXEC.BAT -- like the one described above, but no copy to RAM:
  90.  
  91. echo off
  92. log off
  93. prompt $n:$p > 
  94. switchar -
  95. path a:\
  96. cd a:\
  97. cd d:\
  98.  
  99. ED.BAT -- edits and compiles .def files:
  100.  
  101. rem Call editor and (optionally) compiler for file %1.def.
  102. rem Assumes %1.def is in a: drive's current directory.
  103. rem Compiler errors will restart editor.
  104. rem Deletes editor's backup file (%1.dez).
  105. :edit
  106. d:\editor a:%1.def
  107. del a:%1.dez
  108. input Compile (y+return or return)?
  109. if not %:i==y goto done
  110. verify off
  111. d:\modula a:%1.def
  112. verify on
  113. if exists a:%1.erm goto edit
  114. :done
  115.  
  116. EM.BAT -- edits and compiles .mod files:
  117.  
  118. rem Call editor and (optionally) compiler and linker for file %1.mod.
  119. rem Assumes %1.mod is in a: drive's current directory.
  120. rem Compiler errors will restart editor.
  121. rem Deletes editor's backup file (%1.moz).
  122. rem Optional desk accessory link.
  123. :edit
  124. d:\editor a:%1.mod
  125. del a:%1.moz
  126. input Compile (y+return or return)?
  127. if not %:i==y goto done
  128. verify off
  129. d:\modula a:%1.mod
  130. verify on
  131. if exists a:%1.erm goto edit
  132. input Link (y+return or return)?
  133. if not %:i==y goto done
  134. input Link as desk accessory (y+return or return)?
  135. if not %:i==y goto notacc
  136. ren d:\gemaccx.lnk d:\gemx.lnk
  137. a:\linker a:%1.lnk
  138. ren d:\gemx.lnk d:\gemaccx.lnk
  139. goto done
  140. :notacc
  141. a:\linker a:%1.lnk
  142. :done
  143.  
  144. MD.BAT -- compiles .def files:
  145.  
  146. rem Call compiler for file %1.def.
  147. rem Assumes %1.def is in a: drive's current directory.
  148. rem Compiler errors will start editor.
  149. rem Deletes editor's backup file (%1.dez).
  150. goto compile
  151. :edit
  152. d:\editor a:%1.def
  153. del a:%1.dez
  154. input Compile (y+return or return)?
  155. if not %:i==y goto done
  156. :compile
  157. verify off
  158. d:\modula a:%1.def
  159. verify on
  160. if exists a:%1.erm goto edit
  161. :done
  162.  
  163. MM.BAT -- compiles .mod files:
  164.  
  165. rem Call compiler and (optionally) linker for file %1.mod.
  166. rem Assumes %1.mod is in a: drive's current directory.
  167. rem Compiler errors will restart editor.
  168. rem Deletes editor's backup file (%1.moz).
  169. rem Optional desk accessory link.
  170. goto compile
  171. :edit
  172. d:\editor a:%1.mod
  173. del a:%1.moz
  174. input Compile (y+return or return)?
  175. if not %:i==y goto done
  176. :compile
  177. verify off
  178. d:\modula a:%1.mod
  179. verify on
  180. if exists a:%1.erm goto edit
  181. input Link (y+return or return)?
  182. if not %:i==y goto done
  183. input Link as desk accessory (y+return or return)?
  184. if not %:i==y goto notacc
  185. ren d:\gemaccx.lnk d:\gemx.lnk
  186. a:\linker a:%1.lnk
  187. ren d:\gemx.lnk d:\gemaccx.lnk
  188. goto done
  189. :notacc
  190. a:\linker a:%1.lnk
  191. :done
  192.  
  193. L.BAT -- links .lnk files:
  194.  
  195. rem Link file a:%1.lnk.
  196. a:\linker a:%1.lnk
  197.  
  198. LA.BAT -- links .lnk files as desk accessories:
  199.  
  200. rem Link file a:%1.lnk as a desk accessory.
  201. ren d:\gemaccx.lnk d:\gemx.lnk
  202. a:\linker a:%1.lnk
  203. ren d:\gemx.lnk d:\gemaccx.lnk
  204. ren a:%1.prg a:%1.acc
  205.  
  206.  
  207.                             AN EXAMPLE
  208.  
  209. Let's say you're writing a program called "test" and that it will 
  210. have a main module called "test" and a library module called 
  211. "libr".  You want to put all your work in the subdirectory "mydir" 
  212. so create mydir with the pcommand command "mkdir mydir" and make 
  213. that the current drive by typing "cd a:\mydir" at the pcommand 
  214. prompt.  First write libr.def by typing "ed libr" at the pcommand 
  215. prompt.  When there are no more compile errors write libr.mod by 
  216. typing "em libr" at the prompt.  Then write test.mod using "em 
  217. test".  When you're all done mydir will contain libr.def, libr.mod, 
  218. libr.sym, libr.lnk, test.mod, test.lnk, and test.prg.    
  219.